import http from '../common/vmeitime-http/interface.js'

//获取session_key和openid
const getToken = (data) => {
    return http.request({
        url: 'wechat/small/wx_token',
        method: 'GET', 
        data
    })
}
//解密
const decode = (data) => {
    return http.request({
        url: 'wechat/small/jm',
        method: 'GET', 
        data
    })
}
//注册
const register = (data) => {
    return http.request({
        url: 'wechat/small/register',
        method: 'GET', 
        data
    })
}
//获取用户信息
const getUserInfo = (data) => {
    return http.request({
        url: 'wechat/user/info',
        method: 'GET', 
        data
    })
}
//订单数量提示
const getTipNumber = (data) => {
	return http.request({
        url: 'wechat/shoppingorder/getordercountsbyuserid',
        method: 'GET', 
        data
    })
}
//订单列表
const getOrderList = (data) => {
	return http.request({
	    url: 'wechat/shoppingorder/getordersbyuseridandstatus',
	    method: 'GET', 
	    data
	})
}
//订单详情
const getOrderDetails = data => {
	return http.request({
	    url: 'wechat/shoppingorder/getorderdetail',
	    method: 'GET', 
	    data
	})
}
//地址列表
const getAddressList = data => {
	return http.request({
	    url: 'wechat/user/address/list',
	    method: 'GET', 
	    data
	})
}
//删除当前地址
const deleteAddress = data => {
	return http.request({
	    url: 'wechat/user/address/delete',
	    method: 'GET', 
	    data
	})
}
//查询当前地址
const searchAddress = data => {
	return http.request({
	    url: 'wechat/user/address/info',
	    method: 'GET', 
	    data
	})
} 
//更新保存当前地址
const updateAddress = data => {
	return http.request({
	    url: 'wechat/user/address/update',
	    method: 'GET', 
	    data
	})
}
//新增地址
const addAddress = data => {
	return http.request({
	    url: 'wechat/user/address/add',
	    method: 'GET', 
	    data
	})
}
//余额明细
const getBalanceList = data => {
	return http.request({
	    url: 'wechat/balance/list',
	    method: 'GET', 
	    data
	})
}
//验证码
const getVerificationCode = data => {
	return http.request({
	    url: 'wechat/captcha/captcha',
	    method: 'GET', 
	    data,
		responseType:'arraybuffer'
	})
}
export default {
	getToken,
	decode,
	register,
	getUserInfo,
	getTipNumber,
	getOrderList,
	getOrderDetails,
	getAddressList,
	deleteAddress,
	searchAddress,
	updateAddress,
	addAddress,
	getBalanceList,
	getVerificationCode
}